<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class IndexData extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('index_data', function (Blueprint $table) {
            $table->engine = 'Innodb';
            $table->increments('id');
            $table->char('at', 6)->comment('时间段');
            $table->integer('type_id')->comment('类型ID');
            $table->integer('index_id')->default(0)->comment('指标ID');
            $table->integer('value')->default(0)->comment('目标值');
            $table->timestamps();
            $table->comment = '指标目录数据表';
            $table->index('at', 'idx_at');
            $table->index('index_id', 'idx_index_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('index_data');
    }
}
